package cn.xuguowen.user.designPatten.chain_of_responsibility.heima;

/**
 * ClassName: Client
 * Package: cn.xuguowen.user.designPatten.chain_of_responsibility.heima
 * Description: 客户端
 *
 * @Author 徐国文
 * @Create 2023/6/2 17:15
 * @Version 1.0
 */
public class Client {

    public static void main(String[] args) {
        // 1.创建请假条对象
        LeaveRequest leaveRequest = new LeaveRequest("徐国文",8L,"身体不适，呈现阳性");

        // 2.设置后继链（设置上级领导）.容易出现循环引用
        GroupLeader groupLeader = new GroupLeader();
        DepLeader depLeader = new DepLeader();
        GeneralLeader generalLeader = new GeneralLeader();

        groupLeader.setNextHandler(depLeader);
        depLeader.setNextHandler(generalLeader);

        // 3.开始提交请假审批流程
        // 注意：这里具体的处理者之间构成单链，而不是环形的！所以必须从groupLeader对象开始调用
        groupLeader.submit(leaveRequest);

    }
}
